package com.kaishengit.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.kaishengit.dao.TaskDao;
import com.kaishengit.dao.core.DateUtil;
import com.kaishengit.dao.core.Page;
import com.kaishengit.dao.core.Where;
import com.kaishengit.pojo.Task;

@Transactional

public class TaskService {
	
	
	private TaskDao taskDao;
	
	public void savetask(Task task){
				
		task.setCreatetime(DateUtil.getNow());
				
		taskDao.save(task);
	}
	
	
	public List<Task> findByUser(String userid) {
		return taskDao.findBy("userid", userid);
	}
	
	public Page<Task> findAll(Page<Task> page,List<Where> wherelist) {
		return taskDao.find(wherelist, page);
	}
	
	public Task findById(String id) {
		return taskDao.get(id);
	}
	
	public void update(Task task) {		
		taskDao.save(task);
	}
	
	public void del(Task task) {
		taskDao.del(task);		
	}
	//set get
	public void setTaskDao(TaskDao taskDao) {
		this.taskDao = taskDao;
	}
	
	
}
